import request from '@/common/request/request.js'
import config from '@/common/config/config.js';
const http = config.env

// 购物车列表
export const getShoppingCartList = (data) => {
	return request({
		url: http.baseUrl + '/shopCart/cartList',
		method: 'GET',
		data
	})
}
// 购物车商品删除
export const deleteCartGoods = (data) => {
	return request({
		url: http.baseUrl + '/shopCart/removeCart',
		method: 'GET',
		data
	})
}
// 购物车商品 数量更改
export const addCartGoodsNum = (data) => {
	return request({
		url: http.baseUrl + '/shopCart/updateCartNum2'+data,
		method: 'POST'
	})
}
// 购物车商品 创建订单
export const createOrderFromCart = (data) => {
	return request({
		url: http.baseUrl + '/shopCart/createOrder',
		method: 'POST',
		data
	})
}




// 添加到购物车
export const postAddCart = data => {
  return request({
		url: 'api/basket',
    method: 'post',
    data
  })
}
// 编辑购物车商品数量、规格
export const postEditCart = (data, id) => {
	return request({
		url: `api/basket/${id}`,
		method: 'put',
		data
	})
}
// 购物车商品删除
export const postDleCart = id => {
	return request({
		url: `api/basket/${id}`,
		method: 'delete'
	})
}
